"""
@title(TenX腾晓2024年11月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
"""
from typing import List, Tuple


class TenXClass:
    def __init__(self):
        self.name = "江泽林"
        self.id = "3124002010"

    @staticmethod
    def question1(n: int) -> list[str]:
        print(n)  # 打印，防止IDE警告

        def zhuanjinzhi(n):
            if n == 0:
                return "0"
            else:
                str1 = ""
                while n:
                    n, remainder = divmod(n, 4)
                    str1 = str(remainder) + str1
                return str1


        a = []
        for i in range(1, n + 1):
            zhuanjinzhi(i)
            a.append(zhuanjinzhi(i))

        return a

    @staticmethod
    def question2() -> list[tuple[int, int, int]]:
        list1 = []  # 接受所有可能的x， y， z

        def buy_thing(x, y, z):
            a_list = []
            for a in range(0, x):
                for b in range(0, y):
                    for c in range(0, z):
                        if 5 * a + 3 * b + c == 100 and a + b + 3 * c == 100:
                            a_list.append((a, b, 3 * c))
            return a_list

        for a1 in buy_thing(100, 100, 100):
            list1.append(a1)
        return list1

    @staticmethod
    def question3(equipment: list[str], prop: list[str], material: list[str], items: list[str]) -> dict[str, list[str]]:
        print(equipment, prop, material, items)  # 打印，防止IDE警告



        dict1 = {
            "equipment": [],
            "prop": [],
            "material": []
        }
        for i in items:
            if i in equipment:
                dict1["equipment"].append(i)
            elif i in prop:
                dict1["prop"].append(i)
            elif i in material:
                dict1["material"].append(i)
        return dict1

    @staticmethod
    def question4(item_values: dict[str, int], items: list[str]) -> tuple[list[str], int]:
        print(item_values, items)  # 打印，防止IDE警告


        list1 = []


        for i in items:
            list1.append(item_values[i])

        list2 = sorted(list1, reverse=True)
        total_money = int(list2[0]) + int(list2[1]) + int(list2[2])    # 算总价
        equipment1 = []
        equipment = []
        equipment1.append(list2[0])
        equipment1.append(list2[1])
        equipment1.append(list2[2])
        for j in equipment1:
            for k in item_values:
                if j == item_values[k] and len(equipment) < 3:
                    equipment.append(k)    # 找武器
        total_list = []
        total_list.append(equipment)
        total_list.append(total_money)
        list3 = tuple(total_list)
        return list3

    @staticmethod
    def question5(matrix: list[list[int]]) -> list[tuple[int, int]]:
        print(matrix)  # 打印，防止IDE警告

        def zhaozuobiao():
            zuobiao = []
            for x in matrix:
                for y in x:
                    if y != 0:
                        continue
                    else:
                        zuobiao.append((matrix.index(x) + 1, x.index(y) + 1))
                        matrix[matrix.index(x)][x.index(y)] = 1

            return zuobiao
        zhaozuobiao()
        return zhaozuobiao()

